﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class GetAllCutsAndAlbumsSorted : System.Web.UI.Page
{
    DataSet AllCutsAndAlbums = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        AllCutsAndAlbums = MusicLine.MusicLineController.GetAllCutsAndAlbums();
        uxAllAlbumsRepeater.DataSource = AllCutsAndAlbums;
        uxAllAlbumsRepeater.DataMember = "Albums";
        uxAllAlbumsRepeater.DataBind();
    } // end of Page_Load()

    protected void GetSortedChildView(Object sender, RepeaterItemEventArgs e)
    {
        DataRowView ParentRepeater = e.Item.DataItem as DataRowView;
        if (ParentRepeater != null)
        {
            Repeater ChildRepeater = e.Item.FindControl("uxAllCutsRepeater") as Repeater;
            if (ChildRepeater != null)
            {
                DataView SortedView = ParentRepeater.CreateChildView("Albums_Cuts");
                SortedView.Sort = "Title ASC";
                ChildRepeater.DataSource = SortedView;
                ChildRepeater.DataBind();
            }
        }
    } // end of GetSortedChildView()
}
